//
// Created by jsjxsy on 2022/8/29.
//
#include <iostream>
#include <string>
using namespace std;
//模版类作为参数传递
template<typename NameType, typename AgeType>
class Person {
 public:
  Person(NameType name, AgeType age) : name(name), age(age) {}
  void show() {
    cout << "name=" << name << ", age=" << age << endl;
  }
 public:
  NameType name;
  AgeType age;
};
void printPerson1(Person<string, int> &p) {
  p.show();
}

template<typename NameType, typename AgeType>
void printPerson2(Person<NameType, AgeType> &p) {
  p.show();
  cout << "NameType:" << typeid(NameType).name() << endl;
  cout << "AgeType:" << typeid(AgeType).name() << endl;
}

template<typename T>
void printPerson3(T &p) {
  p.show();
  cout << "T type:" << typeid(T).name() << endl;
}

int main() {
  Person<string, int> p1("lisi", 10);
  printPerson1(p1);
  printPerson2(p1);
  printPerson3(p1);
  return 0;
}

